/*
 * PGN_Reader : A simple pgn reader for chess games.
 * Copyright (C) 2011 Laurent BERNABE
 * 
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package com.gmail.bernabe.laurent.java_swing.pgn_reader.processing;

/**
 * Chess piece representation.
 * @author laurent-bernabe
 *
 */
public class ChessPiece {
	

	/**
	 * Constructor
	 * @param force - PieceForce - What kind of piece is it ? (King, Knight, ...)
	 * @param color - PieceColor - What is it color ? (White piece, black piece)
	 */
	public ChessPiece(PieceForce force, PieceColor color) {
		this.force = force;
		this.color = color;
	}

	/**
	 * What is it color ? (White piece, black piece)
	 * @return PieceColor - the color
	 */
	public PieceColor getColor(){
		return color;
	}
	
	/**
	 * What kind of piece is it ? (King, Knight, ...)
	 * @return PieceForce - the force
	 */
	public PieceForce getForce(){
		return force;
	}

	@Override
	public boolean equals(Object other) {
		if (! (other instanceof ChessPiece) )
			return false;
		ChessPiece otherPiece = (ChessPiece) other;
		return (color.equals(otherPiece.color) &&
				force.equals(otherPiece.force));
	}

	@Override
	public int hashCode() {
		return force.hashCode() * 100 + color.hashCode();
	}
	
	private PieceColor color;
	private PieceForce force;
	
	
}
